package jdbc;

import java.sql.Connection;
import java.sql.PreparedStatement;

public class JDBCDemo10 {
    public static void main(String[] args) {
        try (Connection conn = DBUtil.getConnection();) {
            conn.setAutoCommit(false);
            String sql="DELETE FROM user  WHERE  id=? ";
            PreparedStatement stmt = conn.prepareStatement(sql);
            stmt.setString(1, "1");
            int count = stmt.executeUpdate();
            System.out.println(count>0?"删除成功":"删除失败");
            conn.commit();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}
